package com.xilai.cuteBoy.common.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*************************************************************
 * Description: 日志打印
 * Author: Liu Junbo
 * CreateTime: 2017/5/2
 * Copyright © 西安喜来快递有限公司 All right reserved
 ************************************************************/
//
// @Aspect
public class RpcLogAspect {

    private static Logger _log = LoggerFactory.getLogger(RpcLogAspect.class);

    // 开始时间
    private long startTime = 0L;
    // 结束时间
    private long endTime = 0L;

    @Before("execution(* *..*Controller.*(..))")
    public void doBeforeInServiceLayer(JoinPoint joinPoint) {
        _log.info("doBeforeInServiceLayer");
        startTime = System.currentTimeMillis();
    }

    @After("execution(* *..*Controller.*(..))")
    public void doAfterInServiceLayer(JoinPoint joinPoint) {
        _log.info("doAfterInServiceLayer");
        _log.info("asdjfhbasldkgjblsakjgbalskjgdb");
    }


    @Around("execution(* *..*Controller.*(..))")
    public void doAround(ProceedingJoinPoint pjp)  {
        System.out.println("进入环绕通知");
        _log.info("doAround");
    }

}
